home *** CD-ROM | disk | FTP | other *** search
/ The PC-SIG Library 9 / The PC-SIG Library on CD ROM - Ninth Edition.iso / 001_100 / DISK0052 / DISK0052.ZIP / FILEMOD.ASC < prev    next >
Text File  |  1983-03-29  |  9KB  |  209 lines

  1. 10 REM ********************************************************************
  2. 20 REM *       DiskMod            by          John Vandegrift      *
  3. 30 REM *                                  *
  4. 40 REM *  This program allows the user to modify diskette sectors in the  *
  5. 50 REM *  following way.  The user specifies the sector that he wants to  *
  6. 60 REM *  review.  This sector is loaded into memory.  It is key that the *
  7. 70 REM *  user realize that only one sector is in memory at any one time. *
  8. 80 REM *  The user can then review and modify this sector using option 2  *
  9. 90 REM *  on the master menu.  In the review/alter section, the cursor      *
  10. 100 REM *  move the inverse video cursor.  The top of the screen will show *
  11. 110 REM *  what sector is being worked on and the bottom of the screen has *
  12. 120 REM *  the commands.  On the 24th line, the user is shown the new value*
  13. 130 REM *  and the current value for the location where the cursor is       *
  14. 140 REM *  located, in base ten.  The new value is entered by entering the *
  15. 150 REM *  number followed by a carriage return.  The sector is displayed  *
  16. 160 REM *  in two sections, the hex values on the left part of the screen  *
  17. 170 REM *  and the character equivalents on the right part of the screen.  *
  18. 180 REM *  X exits this section and takes the user back to the menu.       *
  19. 190 REM *    Option 3 of the menu is the inly way to actually save data *
  20. 200 REM *  to the diskette.  When option 3 is selected, the current con-   *
  21. 210 REM *  tents of the sector buffer are dumped to the last sector       *
  22. 220 REM *  loaded in option 1 of the menu.  Note: Option 2 just changes    *
  23. 230 REM *  the sector buffer in memory, not the contents of the diskette.  *
  24. 240 REM *  Option 3 changes the contents of the diskette.           *
  25. 250 REM *    User must have 64k memory and 1 disk drive, minimum       *
  26. 260 REM *  configuration.                           *
  27. 270 REM ********************************************************************
  28. 280 CLEAR ,&H4000:KEY OFF
  29. 290 DEF SEG=0
  30. 300 GOSUB 1730
  31. 310 REM      Assembler Routine
  32. 320 REM
  33. 330 REM  This routine pokes a machine language subroutine into high memory.
  34. 340 REM  This subroutine reads and writes the diskette sector
  35. 350 REM  from/to the diskette to/from upper memory.
  36. 360 REM  The diskette buffer area starts at &hcc00 and is 512 bytes.
  37. 370 REM  The subroutine is loaded at &hE000 and is 38 bytes.
  38. 380 REM
  39. 390 DATA &h55,&h06,&hb8,&h00,&h00
  40. 400 DATA &h8e,&hc0,&h8b,&hec,&h8b
  41. 410 DATA &h76,&h0c,&h8b,&h04,&h8a
  42. 420 DATA &he0,&hb0,&h01,&hbb,&h00
  43. 430 DATA &hcc,&h8b,&h76,&h08,&h8b
  44. 440 DATA &h0c,&h8b,&h76,&h0a,&h8b
  45. 450 DATA &h14,&hcd,&h13,&h07,&h5d
  46. 460 DATA &hca,&h06,&h00
  47. 470 FOR I=1 TO 38:READ J:SUM=SUM+J:NEXT I
  48. 480 IF SUM<>3700 THEN CLS:PRINT "Sum = ";SUM;". Data Error!":STOP
  49. 490 RESTORE
  50. 500 FOR I=0 TO 37:READ J:POKE &HE000+I,J:NEXT I
  51. 510 SUBRT=&HE000
  52. 520 REM
  53. 530 REM     Set up variable to indicate whether diskette has been
  54. 540 REM     read yet.
  55. 550 REM
  56. 560 NOTREAD=1
  57. 570 REM
  58. 580 REM     Master Menu
  59. 590 REM
  60. 600 REM  The user may want to follow the options in order of occurance,
  61. 610 REM  first declaring the sector, altering it and finally
  62. 620 REM  writing it back to the diskette.
  63. 630 REM
  64. 640 GOSUB 1890
  65. 650 CLS:LOCATE 2,37:PRINT "DiskMod "
  66. 660 IF NOTREAD THEN LOCATE 23,30:PRINT "Sector not declared!!":GOTO 690
  67. 670 LOCATE 23,30:IF NOSIDES=1 THEN PRINT "Single-sided diskette":GOTO 690
  68. 680 PRINT "Double-sided diskette"
  69. 690 LOCATE 10,30:PRINT "1. Select Diskette Sector"
  70. 700 LOCATE 11,30:PRINT "2. Review/Alter Sector"
  71. 710 LOCATE 12,30:PRINT "3. Update Diskette"
  72. 720 LOCATE 13,30:PRINT "4. Help"
  73. 730 LOCATE 14,30:PRINT "5. Exit"
  74. 740 LOCATE 16,30:INPUT "Choice";IANS
  75. 750 ON IANS GOSUB 910,1210,790,1980,1730
  76. 760 IF IANS=5 THEN KEY ON:END
  77. 770 GOTO 650
  78. 780 REM
  79. 790 REM     Put Sector on diskette
  80. 800 REM
  81. 810 REM    This routine takes the diskette sector image in upper memory
  82. 820 REM    and writes it to the diskette.  The sector parameters previously
  83. 830 REM    selected are used.  The user could allow modification of the
  84. 840 REM    track and sector numbers to put the sector image in another place.
  85. 850 REM
  86. 860 IF NOTREAD THEN RETURN
  87. 870 A%=3
  88. 880 CALL SUBRT (A%, B%, C%)
  89. 890 RETURN
  90. 900 REM
  91. 910 REM     Select Sector to be Displayed
  92. 920 REM
  93. 930 REM    Allows the user to select the drive and side (if double sided)
  94. 940 REM    as well as track and sector.  Also loads this sector into memory.
  95. 950 REM
  96. 960 CLS
  97. 970 LOCATE 10,10:INPUT "Select drive (A-B)";DRIVE$
  98. 980 IF DRIVE$="a" OR DRIVE$="A" THEN DRIVE=0:GOTO 1010
  99. 990 IF DRIVE$="b" OR DRIVE$="B" THEN DRIVE=1:GOTO 1010
  100. 1000 GOTO 970
  101. 1010 A%=2:B%=DRIVE:C%=2
  102. 1020 CALL SUBRT (A%, B%, C%)   'check for single/double sided
  103. 1030 NOTREAD=1
  104. 1040 IF PEEK(&HCC00)=&HFF THEN NOSIDES=2:NOTREAD=0:GOTO 1080
  105. 1050 IF PEEK(&HCC00)=&HFE THEN NOSIDES=1:NOTREAD=0:GOTO 1080
  106. 1060 LOCATE 15,10:INPUT "Diskette not correctly formatted. C/R to go on.";IANS
  107. 1070 GOTO 1190
  108. 1080 LOCATE 11,10:INPUT "Select track (0-39)";TRACK
  109. 1090 IF TRACK<0 OR TRACK>39 THEN 1080
  110. 1100 LOCATE 12,10:INPUT "Select sector (1-8)";SECTOR
  111. 1110 IF SECTOR<1 OR SECTOR>8 THEN 1100
  112. 1120 HEAD=0:IF NOSIDES=1 THEN 1150
  113. 1130 LOCATE 13,10:INPUT "Select side (0-1)";HEAD
  114. 1140 IF HEAD<0 OR HEAD>1 THEN 1130
  115. 1150 LOCATE 20,10:INPUT "Inputs satisfactory";IANS$
  116. 1160 IF LEFT$(IANS$,1)<>"Y" AND LEFT$(IANS$,1)<>"y" THEN 960
  117. 1170 B%=(HEAD*256)+DRIVE:C%=(TRACK*256)+SECTOR
  118. 1180 CALL SUBRT (A%, B%, C%)
  119. 1190 RETURN
  120. 1200 REM
  121. 1210 REM     Review/Alter Sector Buffer
  122. 1220 REM
  123. 1230 REM   Allows the user to alter sector buffer contents.  Cursor
  124. 1240 REM   arrows move cursor.    Enter number and press return to enter
  125. 1250 REM   new number.    X exits system.
  126. 1260 REM   This function does not save these changes to diskette!
  127. 1270 REM
  128. 1280 IF NOTREAD THEN RETURN
  129. 1290 CLS
  130. 1300 LOCATE 1,1:PRINT "Track ";TRACK;"  Sector ";SECTOR;"  Side ";HEAD;
  131. 1310 PRINT "Drive ";DRIVE$
  132. 1320 GOSUB 1630
  133. 1330 I=0:J=0:GOSUB 1620
  134. 1340 LOCATE 24,1:PRINT "New Value";
  135. 1350 COLOR 0,7:LOCATE 25,1:FOR II=24 TO 27:PRINT CHR$(II);:NEXT
  136. 1360 PRINT " - Cursor    No.+C/R - new no.    X - eXit";
  137. 1370 COLOR 0,7:GOSUB 1570:GOSUB 1610
  138. 1380 A$=INKEY$:IF A$="" THEN 1380
  139. 1390 IF A$=CHR$(13) THEN CHAR=Z:Z=0:GOSUB 1560:GOSUB 1520:GOTO 1370
  140. 1400 GOSUB 1560
  141. 1410 IF A$="X" OR A$="x" THEN RETURN
  142. 1420 IF LEN(A$)=1 THEN 1470 ELSE A$=RIGHT$(A$,1)
  143. 1430 IF A$=CHR$(75) THEN IF J>0 THEN J=J-1
  144. 1440 IF A$=CHR$(77) THEN IF J<23 THEN J=J+1
  145. 1450 IF A$=CHR$(72) THEN IF I>0 THEN I=I-1
  146. 1460 IF A$=CHR$(80) THEN IF I<21 THEN I=I+1
  147. 1470 GOSUB 1620
  148. 1480 IF A$<"/" OR A$>":" THEN 1370
  149. 1490 Z=Z*10+VAL(A$)
  150. 1500 IF Z>255 THEN Z=0
  151. 1510 GOSUB 1610:GOTO 1370
  152. 1520 POKE (&HCC00+J+(I*24)),CHAR
  153. 1530 IF J<23 THEN J=J+1 ELSE IF I<21 THEN I=I+1:J=0 ELSE I=0:J=0
  154. 1540 GOSUB 1620
  155. 1550 RETURN
  156. 1560 COLOR 7,0
  157. 1570 Z$=HEX$(CHAR):IF LEN(Z$)=1 THEN Z$="0"+Z$
  158. 1580 LOCATE I+2,J*2+1:PRINT Z$;:LOCATE ,J+51
  159. 1590 IF CHAR>13 THEN PRINT CHR$(CHAR); ELSE PRINT " ";
  160. 1600 RETURN
  161. 1610 LOCATE 24,12:PRINT Z;:RETURN
  162. 1620 CHAR=PEEK(&HCC00+J+(I*24)):LOCATE 24,30:PRINT "Value";CHAR;:RETURN
  163. 1630 FOR II=0 TO 20:FOR JJ=0 TO 23
  164. 1640 GOSUB 1680
  165. 1650 NEXT JJ:NEXT II
  166. 1660 II=21:FOR JJ=0 TO 7:GOSUB 1680:NEXT JJ
  167. 1670 RETURN
  168. 1680 DAT=PEEK(&HCC00+JJ+(II*24))
  169. 1690 Z$=HEX$(DAT):IF LEN(Z$)=1 THEN Z$="0"+Z$
  170. 1700 LOCATE II+2,JJ*2+1:PRINT Z$;:LOCATE ,JJ+51
  171. 1710 IF DAT>13 THEN PRINT CHR$(DAT); ELSE PRINT " ";
  172. 1720 RETURN
  173. 1730 REM
  174. 1740 REM        Ending Routine
  175. 1750 REM
  176. 1760 CLS
  177. 1770 A$="DiskMod ":B$="b":C$="y":D$="John Vandegrift":COUNT=10
  178. 1780 GOSUB 1820
  179. 1790 A$="        ":B$=" ":C$=" ":D$="               ":COUNT=9
  180. 1800 GOSUB 1820
  181. 1810 LOCATE 23,1:RETURN
  182. 1820 FOR I=1 TO COUNT
  183. 1830 LOCATE I,37:PRINT A$;
  184. 1840 LOCATE 12,4*I:PRINT B$;
  185. 1850 LOCATE 12,81-(4*I):PRINT C$;
  186. 1860 LOCATE 24-I,33:PRINT D$;
  187. 1870 NEXT I
  188. 1880 RETURN
  189. 1890 REM
  190. 1900 REM        Move Header back to top
  191. 1910 REM
  192. 1920 FOR I=14 TO 13 STEP -1:LOCATE I,33:PRINT SPACE$(15);:NEXT I
  193. 1930 A$="DiskMod ":FOR I=12 TO 3 STEP -1
  194. 1940 LOCATE I-1,37:PRINT A$;
  195. 1950 LOCATE I,37:PRINT SPACE$(8);
  196. 1960 NEXT I
  197. 1970 RETURN
  198. 1980 REM
  199. 1990 REM        Help Routine
  200. 2000 REM
  201. 2010 CLS:LOCATE 4,5:PRINT "(1)  Select Diskette Sector allows specification of sector for display."
  202. 2020 LOCATE 7,5:PRINT "(2)  Review/Alter Sector allows the user to review/change sector contents."
  203. 2030 LOCATE 10,5:PRINT "(3)  Update Diskette is the only way to keep changes (2) on the diskette."
  204. 2040 LOCATE 13,5:PRINT "(4)  EXIT ALLOWS THE USER TO EXIT THE PROGRAM."
  205. 2050 LOCATE 16,5:PRINT "(5)  Help is this screen."
  206. 2060 LOCATE 19,5:INPUT "Press return to continue....",IANS
  207. 2070 RETURN
  208. 8821 1/6/82 FR: DAVID BOWMAN
  209.